package com.huawei.appmarket.service.appdetail.view.activity;

import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.huawei.appgallery.foundation.ui.framework.activity.BaseActivity;
import com.huawei.appmarket.service.appdetail.bean.detail.DetailPermissionBean.DetailPermissionItemBean;
import com.huawei.appmarket.service.appdetail.view.widget.DetailPermissionProtocol;
import java.util.List;
import o.azb;
import o.cgv;
import o.CollectCheck;
import o.ewm.c;
import o.ewm.h;
import o.ewm.j;

public class DetailPermissionActivity extends BaseActivity<DetailPermissionProtocol> {
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(h.ˑˊ);
        cgv.ˋ(this, c.ˎ, c.ॱˎ);
        getWindow().getDecorView().setBackgroundColor(getResources().getColor(c.ॱˎ));
        DetailPermissionProtocol detailPermissionProtocol = (DetailPermissionProtocol) ʾ();
        if (detailPermissionProtocol != null && detailPermissionProtocol.ˎ() != null) {
            ˎ(detailPermissionProtocol.ˎ().ॱ(), detailPermissionProtocol.ˎ().ˎ());
        }
    }

    private void ˎ(List<DetailPermissionItemBean> list, String str) {
        ॱ(str);
        LinearLayout linearLayout = (LinearLayout) findViewById(j.ˊᐩ);
        if (!CollectCheck.isEmpty(list)) {
            for (int i = 0; i < list.size(); i++) {
                DetailPermissionItemBean detailPermissionItemBean = (DetailPermissionItemBean) list.get(i);
                View inflate = getLayoutInflater().inflate(h.ˏꜟ, null);
                TextView textView = (TextView) inflate.findViewById(j.ˋᶡ);
                ((TextView) inflate.findViewById(j.ˋᐩ)).setText(detailPermissionItemBean.ˋ());
                textView.setText(detailPermissionItemBean.ˏ());
                linearLayout.addView(inflate);
            }
        }
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        switch (menuItem.getItemId()) {
            case 16908332:
                finish();
                return false;
            default:
                return super.onOptionsItemSelected(menuItem);
        }
    }

    public void ॱ(String str) {
        View findViewById = findViewById(j.ˇˊ);
        findViewById.setPaddingRelative(azb.ʻ(this) - azb.ˊ(this), findViewById.getPaddingTop(), azb.ॱॱ(this) - azb.ˏ(this), findViewById.getPaddingBottom());
        super.ॱ(str);
    }
}
